package com.wb.base;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;

/**
 */
public class TabView extends android.support.design.widget.TabLayoutView {

    public TabView(Context context, AttributeSet attrs) {
        super(context, attrs);

        addOnTabSelectedListener(new android.support.design.widget.TabLayoutView.OnTabSelectedListener() {
            @Override
            public void onTabSelected(android.support.design.widget.TabLayoutView.Tab tab) {

                clickListener.onClick(((ViewGroup) getChildAt(0)).getChildAt(tab.getPosition()));
            }

            @Override
            public void onTabUnselected(android.support.design.widget.TabLayoutView.Tab tab) {

            }

            @Override
            public void onTabReselected(android.support.design.widget.TabLayoutView.Tab tab) {

            }

        });
    }

    final OnClickListener clickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            // 空的OnClickListener
        }
    };

    @Override
    public void draw(Canvas canvas) {
        super.draw(canvas);

    }
}
